<template>
    <div ref="chartContainer" style="width: 222px; height: 155px;"></div>
  </template>
  
  <script setup>
  import * as echarts from 'echarts';
  import { onMounted, ref } from 'vue';
  
  const chartContainer = ref(null);
  
  const initChart = () => {
    if (chartContainer.value) {
      const myChart = echarts.init(chartContainer.value);
  
      const option = {
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'shadow'
          }
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true
        },
        xAxis: [
          {
            type: 'category',
            data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
            show:false
          }
        ],
        yAxis: [
          {
            type: 'value',
            show:false
          }
        ],
        series: [
          {
            name: 'Email',
            type: 'bar',
            stack: 'Ad',
            emphasis: {
              focus: 'series'
            },
            itemStyle: {
            color: "#FF8C00" // 自定义颜色
            },
            data: [120, 132, 101, 134, 90]
          },
          {
            name: 'aaa',
            type: 'bar',
            stack: 'Ad',
            emphasis: {
              focus: 'series'
            },
            itemStyle: {
            color: "#FFA500" // 自定义颜色
            },
            data: [120, 132, 101, 134, 90]
          },
          {
            name: 'Union Ads',
            type: 'bar',
            stack: 'Ad',
            emphasis: {
              focus: 'series'
            },
            itemStyle: {
            color: "#FFD700" // 自定义颜色
            },
            data: [220, 182, 191, 234, 290]
          },
          {
            name: 'Video Ads',
            type: 'bar',
            stack: 'Ad',
            emphasis: {
              focus: 'series'
            },
            itemStyle: {
            color: "#FFFF00" // 自定义颜色
            },
            data: [150, 232, 201, 154, 190]
          }
        ]
      };
  
      myChart.setOption(option);
    }
  };
  
  onMounted(() => {
    initChart();
  });
  </script>
  
  <style scoped>
  /* 你可以在这里添加样式 */
  </style>